'''
Created on 29/09/2014

@author: David
'''
class Memory:
    def __init__(self):
        self.memorySectors = {}
        self.size = 9
        self.reset()

    def write(self,i ,instrs):
        self.memorySectors[i] = instrs

    def read(self,n):
        return self.memorySectors[n]

    def getlastindexused(self):
        return len (self.memorySectors)
    
    def getSize(self):
        return self.size
    
    def reset(self):
        #si pones asi range(self.getSize()) es equivalente a decir i < range(self.getSize())
        for i in range(self.getSize() +1):
            self.memorySectors[i] = None
        